﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DashboardViewModelTests.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Summary description for DashboardViewModelTests
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Client.Test.ViewModel
{
    using System;
    using Hisaab.Business.Interfaces;
    using Hisaab.Windows.Common;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Moq;
    using Windows.Client.ViewModel;

    /// <summary>
    /// Defines the <seealso cref="Hisaab.Client.Test.ViewModel.DashboardViewModelTests"/> type.
    /// </summary>
    [TestClass]
    public class DashboardViewModelTests
    {
        /// <summary>
        /// Consturctors the should thorw exception if account manager null.
        /// </summary>
        [TestMethod, ExpectedException(typeof(ArgumentNullException))]
        public void ConsturctorShouldThorwExceptionIfAccountManagerNull()
        {
            new DashboardViewModel(null, new Mock<ISession>().Object);
        }

        /// <summary>
        /// Consturctors the should thorw exception if session is null.
        /// </summary>
        [TestMethod, ExpectedException(typeof(ArgumentNullException))]
        public void ConsturctorShouldThorwExceptionIfSessionIsNull()
        {
            new DashboardViewModel(new Mock<IAccountManager>().Object, null);
        }

        /// <summary>
        /// Consturctors the should not thorw exception if argument is valid.
        /// </summary>
        [TestMethod]
        public void ConsturctorShouldNotThorwExceptionIfArgumentIsValid()
        {
            new DashboardViewModel(new Mock<IAccountManager>().Object, new Mock<ISession>().Object);
        }

        /// <summary>
        /// Consturctors the should load summary.
        /// </summary>
        [TestMethod]
        public void ConsturctorShouldLoadSummary()
        {
            var mockManager = new Mock<IAccountManager>();
            var mockSession = new Mock<ISession>();
            new DashboardViewModel(mockManager.Object, mockSession.Object);
            mockManager.Verify(x => x.GetAccountTotals(It.IsAny<int>()), Times.Once());
        }
    }
}